package base.day17.innerclass;

import com.sun.source.tree.ReturnTree;

import java.util.Random;

public class TestLambda3 {
    public static void main(String[] args) {
        useRandomNumHandler(new RandomNumHandler() {
            @Override
            public int getNumber() {
                Random rd=new Random();
                int number=rd.nextInt(100);
                return number;
            }
        });
        useRandomNumHandler(()-> {
            Random rd=new Random();
            int number=rd.nextInt(100);
            return number;
        });
    }
    public static void useRandomNumHandler(RandomNumHandler randomNumHandler){
        int result=randomNumHandler.getNumber();
        System.out.println(result);
    }
}
interface RandomNumHandler{
    int getNumber();
}